package datastruct.game;

import datastruct.linkedlist.CircularLinkedList;

import java.util.stream.IntStream;

/**
 * 约瑟夫环
 */
public class Josephus {
    public static void main(String[] args) {
        CircularLinkedList<Integer> list = new CircularLinkedList<>(
                IntStream.range(1,11).boxed().toArray(Integer[]::new)
        );
        System.out.println("开始人数");
        list.forEach(System.out::println);

        int step = 4;
        System.out.println("步长: " + step);

        // System.out.println("约瑟夫环，开始出队：");
        // list.popJosephus(step, System.out::println);

        System.out.println("全部出队，开始出队：");
        list.popAll(step, System.out::println);
    }
}
